import http from '@/utils/request'

// 用户相关接口
export const userApi = {
	//获取token
	getToken() {
		return http.get('/api/front/hitch/driverInfo/getAccessToken')
	},
	// 车主登录
	ownerLogin(data) {
		console.log(data, 'data')
		return http.post(`/api/front/hitch/driverInfo/miniLogin`, data)
	},
	//车主注册
	ownerRegister(data) {
		return http.post(`/api/front/hitch/driverInfo/registerMiniDriverUser`, data)
	},
	//实名认证
	ownerCertification(data) {
		return http.post(`api/front/hitch/driverInfo/realNameAuth`, data)
	}
}

//乘客

export const passenger = {
	// 查询积分
	selectJiFenByUserId(uid){
		return http.get("/api/front/hitch/passengerManager/selectJiFenByUserId?id="+uid);
	},
	// 查询积分规则
	getJiFenGuiZe(){
		return http.get("/api/front/hitch/passengerManager/getJiFenGuiZe");
	},
	// 去后台，设置用户id添加分享领取的积分
	updateUserYaoQingJiFen(id){
		return http.get("/api/front/hitch/passengerManager/updateUserYaoQingJiFen?id="+id);
	}
	,
	//修改订单，确认收货的状态，填写收货时间
	updateOrderPoints(asdf){
		return http.post("/api/front/hitch/passengerManager/updateOrderPoints",asdf);
	},
	// 查询所有馆shi
	selectAllGuanShi(){
		return http.get("/api/front/hitch/passengerManager/selectAllGuanShi");
	},
	// 查询所有馆selectAllYiXueYanJiu
	selectAllYiXueYanJiu(){
		return http.get("/api/front/hitch/passengerManager/selectAllYiXueYanJiu");
	},
	// 查询所有馆selectAllYiXueYanJiu
	selectAllYiXueYanJiu1(){
		return http.get("/api/front/hitch/passengerManager/selectAllYiXueYanJiu1");
	},
	// 查询所有馆selectAllYiXueYanJiu
	selectAllYiXueYanJiu2(){
		return http.get("/api/front/hitch/passengerManager/selectAllYiXueYanJiu2");
	},
	// 查询荣誉资质
	selectAllRongYu(){
		return http.get("/api/front/hitch/passengerManager/selectAllRongYu");
	},
	// 查询研发团队
	selectAllYanFa(){
		return http.get("/api/front/hitch/passengerManager/selectAllYanFa");
	},
	
	//登录
	login(data) {
		return http.post(`/api/front/hitch/passengerManager/miniLogin`, data);
	},
	//预估车费
	estimatedFee(data) {
		return http.post(`/api/front/hitch/passengerManager/estimateFee`, data);
	},
	//预约订单
	reservationOrder(data) {
		return http.post(`/api/front/hitch/passengerManager/createOrder`, data)
	},
	
	//预约订单
	getPaymentInfo(data) {
		return http.post(`/api/front/hitch/pay/payment`, data);
	},
	
	// 添加紧急联系人
	addUserJinJi(data){
		return http.post(`/api/front/hitch/pay/payment`,data);
	},
	
	//点击签到
	qianDao(){
		return http.get("/api/front/hitch/passengerManager/signIn");
	},
	
	//传天数的点击签到
	qianDaos(tianShu){
		return http.get("/api/front/hitch/passengerManager/qianDao?tianShu="+tianShu);
	},
	
	// 查询所有的积分可兑换商品列表
	selectAllJiFenShangPin(){
		return http.get("/api/front/hitch/passengerManager/selectAllJiFenShangPin");
	},
	
	// 查询所有的积分记录，根据用户id查询
	selectAllJiFenJiLuById(){
		return http.get("/api/front/hitch/passengerManager/selectAllJiFenJiLuById");
	},
	//根据用户id查询所有订单
	selectAllOrderById(){
		return http.get("/api/front/hitch/passengerManager/selectAllOrderById");
	}
}

//车主注册
export const owneRegister = {
	//实名认证
	realNameAuth(data) {
		return http.post(`/api/front/hitch/driverInfo/realNameAuth?name=` + data.name + `&idCard=` + data.idCard +
			`&uid=` + data.uid)
	},

	//获取车辆认证信息
	getCarInfoDetail() {
		return http.get(`/api/front/hitch/driverInfo/getCarInfoDetail`)
	},

	//上传文件通用
	uploadFileHandle(data) {
		return http.post(`/api/front/hitch/driverInfo/uploadFileHandle`, data)
	},

	//驾驶证认证
	uploadDriverLicense(data) {
		return http.uploadPost(`/api/front/hitch/driverInfo/uploadDriverLicense`, data)
	},

	//驾驶证提交
	submitDriverLicense(data) {
		return http.post(`/api/front/hitch/driverInfo/submitDriverLicense`, data)
	},

	//行驶证提交
	submitVehicleLicense(data) {
		return http.post(`/api/front/hitch/driverInfo/submitVehicleLicense`, data)
	},

	//行驶证认证
	uploadVehicleLicense(data) {
		return http.post(`/api/front/hitch/driverInfo/uploadVehicleLicense`, data)
	},

	//车辆图片认证
	uploadCarLicense(data) {
		return http.post(`/api/front/hitch/driverInfo/uploadCarLicense`, data)
	},
	
	//车辆认证提交
	submitCarInfo() {
		return http.post(`/api/front/hitch/driverInfo/submitCarInfo`)
	},
	
	//车辆认证提交
	submitCarInfoPay(data) {
		let res = http.post(`/api/front/hitch/pay/deposit/payment`,data);
		console.log(res,123)
		return res;
	}
	
	

}


/**
 * 家/公司地址
 */

export function getAddressInfo(addressType) {
	return http.get('/api/front/hitch/address/user_id/addressList/'+addressType);
}

/**
 * 加入收藏地址
 */

export function setCollectAddress(data) {
	return http.post('/api/front/hitch/address/user_id/collectAddress',data);
}

